@extends('Admin.layout.layout')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>注册用户</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                        <form action="" method="GET">
                            <div class="col-sm-12">
                                <!-- <a href="/demo/details" class="btn btn-sm btn-primary ">添加</a> -->
                                <button type="submit" class="btn btn-sm btn-primary fr"> 搜索</button>
                                <div class="input-group fr10">
                                    <input name="created_at[end]" placeholder="结束日期" class="input-sm form-control layer-date" id="end" value="{{array_get($search_params, 'created_at.end')}}">
                                </div>
                                <div class="input-group fr10">
                                    <input name="created_at[start]" placeholder="开始日期" class="input-sm form-control layer-date" id="start" value="{{array_get($search_params, 'created_at.start')}}">
                                </div>
                                <div class="input-group fr10">
                                    <input type="text" name="keyword" placeholder="用户名/手机号码" class="input-sm form-control" value="{{array_get($search_params, 'keyword')}}">
                                </div>
                                <div class="input-group fr10">
                                    <select  title="" style="padding:0px;" class="input-sm form-control"  name="personal_enterprise"  id="personal_enterprise">
                                        <option value="">请选择</option>
                                        <option @if(0 == $search_params['personal_enterprise']) selected="selected" @endif value="0">个人用户</option>
                                        <option @if(1 == $search_params['personal_enterprise']) selected="selected" @endif value="1">企业用户</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable" id="editable">
                            <thead>
                                <tr>
                                    <th width="15">
                                        <input type="checkbox" class="checkall" name="selectall" />
                                    </th>
                                    <th>ID</th>
                                    <th>手机号/用户名</th>
                                    <th>联系人姓名</th>
                                    <th>公司名称</th>
                                    <th>创立时间</th>
                                    <th class="center">类型</th>
                                    <th class="center">状态</th>
                                    <th class="center">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                
                                @if(!empty($list))
                                    @foreach($list as $value)
                                    <tr class="gradeX">
                                        <th>
                                            <input type="checkbox" class="checkall" name="checkBox" />
                                        </th>
                                        <td>{{array_get($value, 'id')}}</td>
                                        <td>{{array_get($value, 'phone')}}--{{array_get($value, 'name')}}</td>
                                        <td>{{array_get($value, 'company.angent')}}</td>
                                        <td>{{array_get($value, 'company.company_name')}}</td>
                                        <td>{{array_get($value, 'created_at')}}</td>
                                        <td class="center">@if(array_get($value, 'personal_enterprise') == 0) 个人 @elseif(array_get($value, 'personal_enterprise') == 1) 企业 @endif</td>
                                        <td class="center">@if(array_get($value, 'status') == 0) 正常 @elseif(array_get($value, 'status') == 1) <span style="color: red">已禁止</span> @endif</td>
                                        <td class="center">
                                            <a href="{{asset('foradmin/user/'.array_get($value, 'id'))}}" class="btn-xs btn-primary ">查看</a>
                                        </td>
                                    </tr>
                                    @endforeach
                                @else
                                    <tr class="no-records-found center"><td colspan="8">没有找到匹配的记录</td></tr>
                                @endif
                            </tbody>
                        </table>
                        <div class="row">
                            @include('Admin.common.paginate', ['page' => $page])
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script src="{{asset('js/plugins/layer/laydate/laydate.js')}}"></script>


    <script>
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: '1970-01-01 00:00:00', //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: '1970-01-01 00:00:00',
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
    </script>
@endsection
